package routers

import (
	"datum_user/controller"
	"datum_user/middleware"
	"github.com/gin-gonic/gin"
)

func Init() (r *gin.Engine) {
	r = gin.Default()
	r.Use(middleware.Cors())

	u := r.Group("/user")
	{
		u.POST("/login", controller.Login)
		u.POST("/getRegisterCode", controller.GetCode)
		u.POST("/checkRegisterCode", controller.CheckCode)
		u.POST("/createRegisterUser", controller.CreateUser)
		u.POST("/getRestPwdCode", controller.GetCodeRestPwd)
		u.POST("/restPassword", controller.RestPassword)
	}

	i := r.Group("/user/editInfo",middleware.AuthUser())
	{
		i.POST("/nickName",controller.NickName)
	}

	r.GET("/getVerify5Token", controller.GetVerify5Token)
	r.GET("/test", controller.Test)
	return
}
